{extend name='layout/base'}
{block name='title'}{__block__}地址管理{/block}
{block name='content'}

<div class="row left">
    <div class="col-md-2"></div>
    <div class="col-md-8">
        <div class="col-md-4">
            {include file='layout/menu'}             
        </div>      
        <div class="col-md-8">
            <div class="page-header">
                <h1>地址管理
                    <small style="font-size: 14px;">已保存 {$total} 个收货地址（最多添加10条）</small>
                </h1>
                <?php
                    $disabled = $total == 10 ? 'disabled' : '';
                ?>
                <p><a class="btn btn-primary btn-sm pull-right" href="<?php echo url('index/user.AddressAdd/index');?>" role="button" {$disabled}>添加地址</a></p>
            </div>

            <div class="table-responsive">
                <table class="table">
                    <thead>
                        <tr>
                            <th>收件人</th>
                            <th style="width: 360px;">地址</th>
                            <th>联系电话</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {foreach $rows as $row}
                        <tr>
                            <th scope="row">{$row['recipient']}</th>
                            <td>{$row['city'].$row['street'].$row['detailed']}</td>
                            <td>{$row['phone']}</td>
                            <td>
                                <a class="btn btn-info btn-xs" href="<?php echo url("index/user.AddressAdd/index",['id' =>$row->id]);?>" role="button">修改</a>
                                <a class="btn btn-danger btn-xs" href="<?php echo url('index/user.AddressAdd/addressDel',['id' =>$row->id]);?>" role="button" onclick="return confirm('确认删除吗？')">删除</a>
                            </td>
                        </tr>
                        {/foreach}
                    </tbody>
                </table>
            </div>
            <!--分页-->
            <div class="row">   
                <div class="col-md-6 col-md-offset-3">  
                    {$rows->render()}
                </div>  
            </div>
   
        </div>
    </div>
    <div class="col-md-2"></div>
</div>

{/block}